#!/bin/sh
# mkdev.sh - Make embedded linux development env.

#devpath=/opt/work/code_test/board-dev

is_sure=no
while [ "${is_sure}" != "yes" ]
do
    echo -n "Set board-dev path: "
    read devpath
    echo -n "PATH=$devpath,[yes/no]: "
    read is_sure
done

echo "To make tftp service: "
sudo apt-get install openbsd-inetd tftp tftpd
mkdir $devpath/tftp
sudo chmod 777 $devpath/tftp
sudo chmod 777 /etc/inetd.conf
sudo echo "tftp dgram   udp wait    nobody  /usr/sbin/tcpd  /usr/sbin/in.tftpd  $devpath/tftp" >>/etc/inetd.conf
sudo /etc/init.d/openbsd-inetd restart
sudo in.tftpd -l $devpath/tftp

echo "To make nfs service:"
sudo apt-get install nfs-kernel-server nfs-common portmap
sudo gvim /etc/default/portmap
#sudo sysv-rc-conf portmap on
#sudo sysv-rc-conf nfs-kernel-server on
mkdir $devpath/nfs
sudo chmod 777 /etc/exports
sudo echo "$devpath/nfs  *(rw,sync)" >>/etc/exports
sudo exportfs -r
sudo /etc/init.d/nfs-kernel-server restart
